package vip.source.pattern.part23.Interpreter;

import org.junit.jupiter.api.Test;

/**
 * @Description: 解释器模式测试
 * @Author: zy
 **/
public class UnitTest {

    @Test
    public void test() {
        // 构建表达式树： 1 + (2 - 3)
        CustomExpression expression = new AddExpression(new NumberExpression(1),
                new SubtractExpression(new NumberExpression(2), new NumberExpression(3)));

        int result = expression.interpret();
        System.out.println("Result: " + result);
    }
}
